home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
boi.exe
/
GETCMBBS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-12-11
|
49KB
|
1,025 lines
{$D-} { Disable Debug Information }
{$S-} { Disable Stack Checking }
{$V-} { Disable String Checking }
Unit GetCmBBS;
{ Part of BBS Onliner Interface }
{ Copyright (C) 1990 Andrew J. Mead
All Rights Reserved. }
{ Original version 7/1/90 }
{ Original release version 9/5/90 }
{ Original public release 12/15/90 }
{ history found in IOLIB.PAS }
INTERFACE
Uses
boidecl,
DOS;
Procedure GETCOMMAND( { process command line parameters }
infofile, { name of documentation file }
inhof, { default name for text hall of fame }
logfile : pathstr; { name of error log }
gamename, { name of current game }
version : string; { version of current game }
programset : charset); { set of program's command line switches }
IMPLEMENTATION
Uses
iolib;
Type
IRQtype = array [0..15] of byte; { array of IRQ information }
portype = array [0..3] of word; { default port addressess }
Var
inchar : char; { standard input character }
minmax : byte; { maximum time allowed }
Const
timedone : boolean = false; { remaining time figured }
filedone : boolean = false; { BBS file processed }
hofdone : boolean = false; { /y processed }
lockcomm : boolean = false; { /c processed }
lockIRQ : boolean = false; { /i processed }
locklocal : boolean = false; { /l processed }
lockname : boolean = false; { /n processed }
setlocal : boolean = false; { BBS file says it is in local play }
portarray : portype = { default port addressess for Com1 - Com4 }
($3F8,$2F8,$3E8,$2E8);
IRQarray : IRQtype = { interrupt vectors for IRQs 0 - 15 }
($08,$09,$0A,$0B,$0C,$0D,$0E,$0F,$70,$71,$72,$73,$74,$75,$76,$77);
Initarray : IRQtype = { 8259A IRQ enabling masks-used in Async.Pas }
($FE,$FD,$FB,$F7,$EF,$DF,$BF,$7F,$FB,$FB,$FB,$FB,$FB,$FB,$FB,$FB);
{ Entries 8-15 are unknown the cascade mask (for IRQ2) is used }
IRQnum : byte = 4; { default IRQ - Com1 Com3 }
Procedure GETCOMMAND;
var
gcf : text; { user information text file handle }
gcb : file; { user information byte file handle }
gbuffer : array [1..4096] of char; { buffer for gcf-text file buffer }
gcbuffer : array [0..4095] of byte; { buffer for gcb-binary file buffer}
gcstr : string; { current input line from gcf }
insize : word; { size of gcb }
dummy : word; { Val conversion error value }
timetemp : real; { Second/Minute time conversion variable }
opchs : string [2]; { Opus-CBCS Task Designation }
gloop : byte;
Procedure SHOWERROR(param : byte;passtr : string);
{ display error in command line arguments }
var s : text; { errorlog file handle }
Procedure WRITEERROR(outstr : string);
begin {* GetCommand,ShowError,WriteError *}
write(s,'Abnormal termination of program at');
GetTime(hour,minute,second,hunsec);
{time} write(s,hour:1,':',minute:1,':',second:1,' ');
GetDate(hour,minute,second,hunsec);
{date} writeln(s,minute:1,'/',second:1,'/',hour:1,'.');
writeln(s,'ERROR ',param:0);
writeln(outstr);
writeln(s,outstr);
writeln(s)
end; {* GetCommand,ShowError,WriteError *}
begin {* GetCommand,ShowError *}
write(#27'[2J');
assign(s,logfile);
if exist(logfile) then append(s) else rewrite(s);
writeln(gamename,' version ',version,'.');
writeln('Copyright (C) 1990 Andrew J. Mead');
writeln('All Rights Reserved.');
writeln('Contact: POB 1155 Chapel Hill, NC 27514-1155');
writeln;
writeln('Abnormal termination of program:');
writeln;
writeln('ERROR ',param:0);
case param of
1 : WriteError('Too many command line arguments.');
2 : WriteError('Unknown or incorrect argument on command line.');
3 : WriteError(passtr+' file format not supported yet.');
4 : WriteError('Unable to find '+passtr+'. Check implementation or notify Sysop.');
5 : WriteError('Error in '+passtr+'. Check implementation.');
7 : WriteError('Duplicate directives.');
8 : WriteError('Path/Filename for Hall of Fame is not valid.');
9 : WriteError(passtr+' is not a valid path.');
10 : WriteError('Invalid port setting(s) in '+passtr+'.');
11 : WriteError('Invalid or missing numeric in /X:nn.');
12 : WriteError('Hall of Fame limit out of range, must be in 1-19.');
13 : WriteError('Invalid or missing value in /C:n. ''n'' should be 1-4');
16 : WriteError('/L can not be used with either /C or /I');
17 : WriteError('Invalid format in /I:i:nnnn.');
18 : WriteError(passtr+' is not a valid Hexadecimal address in /I statement.');
19 : WriteError('Invalid numeric in /A:x.');
20 : WriteError('/A timeleft should be at least 5.');
21 : WriteError('Error reading data file, check documentation for proper switch.')
end;
writeln;
writeln('Check ',infofile,' for proper installation of this program.');
writeln('Report error message to SysOp.');
writeln;
writeln('Error saved in ',logfile,'.');
delay(5000);
writeln('Now returning to BBS.');
close(s);
halt
end; {* GetCommand,ShowError *}
Procedure PROCESSTEXT( { process BBS system text file for user info }
filestr : pathstr; { name of BBS system file }
getname, { username is in file indicator }
getime, { user time remaining is in file indicator }
getlines, { user screen length is in file indicator }
ismins : boolean; { user time remaining is in minutes indicator }
nameline, { line at which users name is found }
timeline, { line at which users time remaining is found }
lineline, { line at which users screen length is found }
comline, { line at which the comport is listed }
combyte, { byte in comline that determines comport }
doextra : byte); { extra information for a given file - switch }
Procedure RESTART(readline : byte);
{ places the given lines information in gcstring }
var rloop : byte;
begin {* GetCommand,ProcessText,Restart *}
reset(gcf);
{$I-}
for rloop := 1 to readline do readln(gcf,gcstr);
{$I+}
if IOResult <> 0 then ShowError(5,filestr)
end; {* GetCommand,ProcessText,Restart *}
Procedure DORBBS;
{ get users last name, and append it to the first name }
begin {* GetCommand,ProcessText,DoRBBS *}
Restart(8); { Get user's last name }
username := username + ' ' + gcstr
end; {* GetCommand,ProcessText,DoRBBS *}
Procedure DOWWIV;
{ check to see if game is being played locally or from remote }
{ get user's real name }
begin {* GetCommand,ProcessText,DoWWIV *}
Restart(15);
while (gcstr[1] = ' ') and (length(gcstr) > 0) do delete(gcstr,1,1);
if (length(gcstr) > 0) and (gcstr[1] = '0') then setlocal := true;
Restart(3);
usereal := true;
realname := gcstr;
Restart(1);
realname := '#'+ gcstr + ' ' + realname
end; {* GetCommand,ProcessText,DoWWIV *}
Procedure DOSPITFIRE;
{ get user's user number }
begin {* GetCommand,ProcessText,DoSpitfire *}
Restart(1);
usereal := true;
realname := '#' + gcstr
end; {* GetCommand,ProcessText,DoSpitfire *}
Procedure DOWILDCAT;
{ check to see if game is being played locally or from remote }
begin {* GetCommand,ProcessText,DoWildCat *}
Restart(28);
if Pos('LOCAL',gcstr) > 0 then s